<template>
	<view>
		<!-- 选择员工 -->
		<u-picker :show="message.yuangongShow" :columns="columnsyg" :title="titletext" @cancel="yuangongconfirm" @confirm="yuangongconfirm"
			keyName="name"></u-picker>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		props:{
			message:{}
		},
		name:"selectYuangong",
		data() {
			return {
				columnsyg:[],
				titletext:"选择员工"//1=管理,2=普通员工,3=送货员
			};
		},
		watch:{
			message:{
				handler(newval){
					if(newval.value==1){
						this.titletext = "选择管理人员"
					}else if(newval.value==2){
						this.titletext = "选择员工"
					}else if(newval.value==100){
						this.titletext = "选择员工"
					}else{
						this.titletext = "选择送货员"
					}
				},
				deep:true
				
			}
		},
		mounted() {
			httpRequest.request('appapi/manage/staff/all', 'POST', {
				group:this.message.value==100?'':this.message.value
			}, false, false, true).then(res => {
				this.columnsyg.push(res.data)
			})
		},
		methods:{
			yuangongconfirm(e){
				this.$emit("yuangongSure", e);
			}	
		}
	}
</script>

<style>

</style>